<html>
<head>
<title>A document's origin should match the origin of the final HTTP response</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<body>
<script>
  async_test(function(t) {
    var path = new URL("document_origin_redirect_subpage.html", document.location).pathname;
    var CROSS_ORIGIN_URL = new URL(path, get_host_info().HTTP_REMOTE_ORIGIN);
    var SAME_ORIGIN_URL = "/common/redirect.py?location=" + CROSS_ORIGIN_URL;
      console.log(SAME_ORIGIN_URL);
    var iframe = document.createElement('iframe');
    iframe.src = SAME_ORIGIN_URL;
    document.body.appendChild(iframe);
    onmessage = t.step_func_done(function(e) {
        assert_true(e.data[0]);
        assert_true(e.data[1]);
    });
  });
</script>
